﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using BaseUi.ViewModel;
using HandyControl.Controls;

namespace BaseUi
{
    /// <summary>
    /// MainWindow2.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow2 : HandyControl.Controls.Window
    {
        public static MainViewModel viewModel = MainWindow.viewModel;
        public MainWindow2()
        {
            if (!viewModel.InitAgo())
                this.Close();

            InitializeComponent();
            this.DataContext = viewModel;
        }

        private void load(object sender, RoutedEventArgs e)
        {
            viewModel.Init(this);
        }

        private void tabControl_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            //取消tabControl快捷键切换
            if (e.Key == Key.LeftCtrl || e.Key == Key.LeftCtrl || e.Key == Key.Tab)
                e.Handled = true;
        }

        private void menuSelect(object sender, HandyControl.Data.FunctionEventArgs<object> e)
        {
            viewModel.SelectedValue = ((SideMenuItem)e.Info).Tag.ToString();
        }
    }
}
